package gdepot

/*
 * 存放所有和第三方的交互信息和记录, e.g: 存放富友的验卡和支付记录
 */
class TransactionRecord {

    String versionCode      //版本号
    String orderSerialNumber        //请求流水号,当天唯一

    String payType         //支付类型
    double transactionAmount    //交易金额
    String enterpriseSerialNumber = '' //企业流水号
    String description = ''         //订单描述
    String payStatus                 //支付结果

    String responeCode           //富友响应代码
    String responeDescription   //富友响应描述

//    String operateType               //交易类型
//    String withholdingAgreementNo //签约认购/申购代扣协议号
//    String signWithholding        //同时签约认购/申购代扣
//    String notifyURL             //交易结果通知地址
//    String businessType               //CG：短信验证码获取
//    String verificationCode          //短信验证码
//    String responeFuiouSerialNumber    //富友交易流水号
//    String responeDeelTime                //交易执行时间
//    String responeDeelStateCode               //交易执行状态

    Date   createDate = new Date()   // 请求日期
    Date   modifiedDate = new Date() //修改日期

    static belongsTo = [order:Orders, accountBank: AccountBank]

    static constraints = {
        versionCode size: 1..4
        payType maxSize: 50,nullable: true
        orderSerialNumber size: 10..30
        transactionAmount min: 0.0d,nullable: true
        enterpriseSerialNumber size: 0..32,nullable: true
        description maxSize: 100,nullable: true
        payStatus inList: ['Success','Failed', 'Tobepaid'],nullable: true
        responeCode size: 4..6,nullable: true
        responeDescription size: 1..1024,nullable: true

//        operateType maxSize: 10,nullable: true
//        withholdingAgreementNo maxSize: 50,nullable: true
//        signWithholding maxSize: 50,nullable: true
//        notifyURL maxSize: 100,nullable: true
//        businessType maxSize: 5,nullable: true
//        responeFuiouSerialNumber maxSize: 50,nullable: true
//        verificationCode maxSize: 10,nullable: true
//        responeDeelStateCode maxSize: 10,nullable: true
        order nullable: true
        accountBank nullable:true
//        responeDeelTime nullable: true
//        responeDeelStateCode nullable: true
    }

    def beforeUpate(){
        modifiedDate = new Date()
    }
}
